<?php echo $this->element('displayHeader'); ?>
<div class="toolbar"><?php echo $this->element('toolbar', array('buttons' => array('add', 'search', 'refresh'))); ?></div>

<?php if (empty($this->data)) : // ถ้าไม่มีข้อมูล ?>
<div class="fail-flash">
    No record found.
</div>
<? else : // ถ้ามีข้อมูล ?>
<?php $paginator->options(array('update' => 'content', 'indicator' => 'indicator')); ?>
<?php echo $this->element('dataCaptionLimit'); ?>
<?php $cur = $paginator->counter(array('format' => '%start%')); ?>

<table class="data">
    <thead>
        <tr>
            <th class="no"><?php echo $paginator->sort('No', 'Brand.id'); ?></th>
            <th><?php echo $paginator->sort('Name', 'Brand.name'); ?></th>
            <th><?php echo $paginator->sort('Vendor', 'Brand.supplier_id'); ?></th>
            <th class="collect_date"><?php echo $paginator->sort('Collect Date', 'modified'); ?></th>
            <th class="collector"><?php echo $paginator->sort('Collector', 'User.name'); ?></th>
            <th class="action">&nbsp;</th>
        </tr>
    </thead>
    <tbody>
        <?php foreach($this->data as $key => $data): ?>
        <?php
        $tableCell = array();
        $tableCell[] = $cur++;
        $tableCell[] = $html->tag('span', $data['Brand']['name'], array('id' => "name$cur"));
        $tableCell[] = $data['Supplier']['name'];
        $tableCell[] = $html->tag('span', $data['Brand']['modified'], array('class' => 'lower'));
        $tableCell[] = $data['User']['name'];
        $tableCell[] = $ajax->link($html->image('icon/edit.png', array('title' => 'edit', 'alt' => 'edit')), 'view/' . $data['Brand']['id'],
            array('indicator' => 'indicator', 'update' => 'content'), null, false
        );
        echo $html->tableCells($tableCell, array('class' => 'odd-cell'), array('class' => 'even-cell'));
        echo $ajax->editor("name$cur", "inplace_editor/name/{$data['Brand']['id']}");
        ?>
        <?php endforeach; ?>
    </tbody>
</table>

<?php echo $this->element('paging'); ?>
<? endif; ?>